package com.songlanyun.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.songlanyun.common.drive.IntegerEnum;

import java.util.Objects;

/**
 * 宣传素材的相关枚举
 */
public class ShareConfigConstant {


    /**
     * 审核状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum isEnum implements IntegerEnum<Integer>
    {
        //状态 0=否 1=是
        NO(0, "否"),
        YES(1,"是"),
        ;


        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        isEnum(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static isEnum getByCode(int code) {
            for (isEnum value : isEnum.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }
}
